<?php

use yii\helpers\Html;
use yii\grid\GridView;


use app\models\UserInfo;

/* @var $this yii\web\View */
/* @var $searchModel app\models\UserPokerSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = 'User Pokers';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="user-poker-index">

    <h1><?= Html::encode($this->title) ?></h1>
    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <p>
        <?= Html::a('创建牌局', ['create'], ['class' => 'btn btn-success']) ?>
        
    </p>

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            // 'poker_id',
            // 'user_id',
            [
                'header' => '昵称',
                'format'=>'raw',
                'value' => function($data){
                            $model = UserInfo::findOne($data->user_id);
                            return "<p style='width:100px;'>".$model->name."<p>" ;
            }],
            // 'user_agent_id',
            [
                'header' => '代理',
                'format'=>'raw',
                'value' => function($data){
                            if($data->user_agent_id>99){
                                $model = UserInfo::findOne($data->user_agent_id);
                                return "<p style='width:100px;'>".$model->name."<p>" ;
                            }else{
                                return "<p style='width:100px;'>无代理<p>";
                            }
                            
            }],
            'table_id',
            'poker_name',
            // 'user_info.name',

            'score',
            'in_score',
            'out_score',
            
            'end_score',
            'ts',

            ['class' => 'yii\grid\ActionColumn'],
        ],
    ]); ?>
</div>
